home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software of the Month Club 2000 October
/
Software of the Month - Ultimate Collection Shareware 277.iso
/
pc
/
PROGRAMS
/
UTILITY
/
WINLINUX
/
DATA1.CAB
/
sbin_-_Static_Binary_Files
/
LILOCONF.{12
< prev
next >
Wrap
Text File
|
1999-09-17
|
34KB
|
1,135 lines
#!/bin/sh
#
# Copyright 1994, 1998, 1999 Patrick Volkerding, Moorhead, Minnesota USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
TMP=/var/log/setup/tmp
if [ "$COLOR" = "" ]; then
# Set color menu mode unless we detect that we're on the text.gz disk:
if [ ! -r /usr/lib/setup/setup.tty ]; then
COLOR=on
fi
fi
# This is a different 'probe' than the function below.
if [ -x /sbin/probe ]; then
PROBE=/sbin/probe
else
PROBE=/sbin/fdisk
fi
# This function scans for bootable partitions (making some assumptions along
# the way which may or may not be correct, but usually work), and sets up
# LILO in either the superblock, or the MBR.
simplelilo()
{
if $PROBE -l | fgrep 'OS/2 Boot Manager' 1> /dev/null 2> /dev/null ; then
dialog --title "OS/2 BOOT MANAGER FOUND" --yesno \
"Your system appears to have Boot Manager, a boot menu system provided \
with OS/2 and Partition Magic. If you like, we can install a very simple \
LILO boot block at the start of your Linux partition. Then, you can \
add the partition to the Boot Manager menu, and you'll be able to use \
Boot Manager to boot Linux. Would you like to install LILO in a Boot \
Manager compatible way?" 11 65
FLAG=$?
if [ ! $FLAG = 0 -a ! $FLAG = 1 ]; then
exit 1
fi
if [ $FLAG = 0 ]; then # yes, use BM
if [ -r $T_PX/etc/lilo.conf ]; then
mv $T_PX/etc/lilo.conf $T_PX/etc/lilo.conf.orig
fi
cat << EOF > $T_PX/etc/lilo.conf
# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
boot = $ROOT_DEVICE
#delay = 5
vga = normal
# End LILO global section
# Linux root partition section
image = /vmlinuz
root = $ROOT_DEVICE
label = Linux
read-only
# End root Linux partition section
EOF
dialog --infobox "\nInstalling the Linux Loader..." 5 40
if [ "$T_PX" = "/" ]; then
lilo 1> /dev/null 2> /dev/null
else
lilo -r $T_PX -m /boot/map -C /etc/lilo.conf 1> /dev/null 2> /dev/null
fi
return
fi # Use Boot Manager
fi # Boot Manager detected
# If we got here, we either don't have boot manager or don't want to use it
dialog --title "SELECT LILO DESTINATION" --menu \
"LILO can be installed to a variety of places:\n\
\n\
1. The Master Boot Record of your first hard drive.\n\
2. The superblock of your root Linux partition. (which could\n\
be made the bootable partition with DOS or Linux fdisk, or\n\
booted with a program like OS/2 Boot Manager)\n\
3. A formatted floppy disk.\n\
\n\
Options 2 and 3 are the safest, but option 2 does require a little\n\
extra work later (setting the partition bootable with fdisk).\n\
Which option would you like?" \
20 72 3 \
"MBR" "Install to Master Boot Record" \
"Root" "Install to superblock (which must be made bootable)" \
"Floppy" "Install to a formatted floppy in /dev/fd0 (A:)" 2> $TMP/reply
if [ $? = 1 -o $? = 255 ]; then
exit
fi
TG="`cat $TMP/reply`"
rm -r $TMP/reply
if [ "$TG" = "MBR" ]; then
if [ -L $T_PX/dev/hda ]; then
LILO_TARGET="/dev/sda"
elif probe /dev/hda; then
CDROM_LINK=`/bin/ls -l $T_PX/dev/cdrom`
CDROM_LINK=`echo $CDROM_LINK | cut -f 11 -d ' '`
if [ "$CDROM_LINK" = "/dev/hda" -o "$CDROM_LINK" = "hda" ]; then
LILO_TARGET="/dev/sda" # It must be sda, if there's a CDROM on hda.
else
LILO_TARGET="/dev/hda"
fi
elif probe /dev/sda; then
LILO_TARGET="/dev/sda"
else
dialog --msgbox "LILO can't find your first hard drive! Sorry, \
but LILO is getting /dev/null'ed..." 10 50
LILO_TARGET="/dev/null"
fi
elif [ "$TG" = "Root" ]; then
LILO_TARGET=`echo $ROOT_DEVICE`
elif [ "$TG" = "Floppy" ]; then
LILO_TARGET="/dev/fd0"
fi
cat << EOF > $T_PX/boot/boot_message.txt
Welcome to the LILO Boot Loader!
Please enter the name of the partition you would like to boot
at the prompt below. The choices are:
EOF
cat << EOF > $T_PX/etc/lilo.conf
# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
boot = $LILO_TARGET
message = /boot/boot_message.txt
prompt
timeout = 1200
vga = normal
# End LILO global section
EOF
# OK, now let's look for DOS partitions:
DOSP="`$PROBE -l | fgrep "DOS
Win95"`"
DOSP="`echo $DOSP | cut -f 1 -d ' '`"
if [ ! "$DOSP" = "" ]; then
TABLE="`echo $DOSP | cut -b1-8`"
cat << EOF >> $T_PX/etc/lilo.conf
# DOS bootable partition config begins
other = $DOSP
label = DOS
table = $TABLE
# DOS bootable partition config ends
EOF
echo "DOS - DOS or Windows (FAT/FAT32 partition)" >> $T_PX/boot/boot_message.txt
fi
# Next, we search for Linux partitions:
LNXP="`$PROBE -l | fgrep "Linux native"`"
LNXP="`echo $LNXP | cut -f 1 -d ' '`"
if [ ! "$LNXP" = "" ]; then
cat << EOF >> $T_PX/etc/lilo.conf
# Linux bootable partition config begins
image = /vmlinuz
root = $ROOT_DEVICE
label = Linux
read-only
# Linux bootable partition config ends
EOF
echo "Linux - Linux (ext2fs partition)" >> $T_PX/boot/boot_message.txt
fi
# OK, hopefully we can remember how to deal with OS/2 :^)
OS2P="`$PROBE -l | fgrep "HPFS"`"
OS2P="`echo $OS2P | cut -f 1 -d ' '`"
if [ ! "$OS2P" = "" ]; then
TABLE="`echo $OS2P | cut -b1-8`"
if [ "$TABLE" = "/dev/hda" ]; then
cat << EOF >> $T_PX/etc/lilo.conf
# OS/2 bootable partition config begins
other = $OS2P
label = OS2
table = $TABLE
# OS/2 bootable partition config ends
EOF
else
cat << EOF >> $T_PX/etc/lilo.conf
# OS/2 bootable partition config begins
other = $OS2P
label = OS2
table = $TABLE
loader = /boot/os2_d.b
map-drive = 0x80
to = 0x81
map-drive = 0x81
to = 0x80
# OS/2 bootable partition config ends
EOF
echo "OS2 - OS/2 Warp (HPFS partition)" >> $T_PX/boot/boot_message.txt
fi
fi
echo >> $T_PX/boot/boot_message.txt
# Done, now we must install lilo:
dialog --infobox "\nInstalling the Linux Loader..." 5 40
if [ "$T_PX" = "/" ]; then
lilo 1> /dev/null 2> /dev/null
SUCCESS=$?
else
lilo -r $T_PX -m /boot/map -C /etc/lilo.conf 1> /dev/null 2> /dev/null
SUCCESS=$?
fi
if [ ! "$SUCCESS" = "0" ]; then # some LILO error occured
dialog --title "LILO INSTALL ERROR # $SUCCESS" --msgbox \
"Sorry, but the attempt to install LILO has returned an error, so LILO \
has not been correctly installed. You'll have to use a bootdisk \
to start your \
machine instead. It should still be possible to get LILO working by \
editing the /etc/lilo.conf and reinstalling LILO manually. See the \
LILO man page and documentation in /usr/doc/lilo/ for more help." 11 60
fi
}
checkp_text()
{
if [ ! -r $1 ]; then
echo
echo "I can't find a device named '$1'!"
echo
echo -n "Are you sure you want to use this device name [y]es, [n]o? "
read use_device;
if [ ! "$use_device" = "y" ]; then
return 1;
fi
return 0;
fi
}
checkp_dialog()
{
if [ ! -r $1 ]; then
dialog --title "DEVICE FILE NOT FOUND" --yesno "I can't find a \
device named '$1'. Are you sure you want to use this device \
name?" 7 60
return $?;
fi
}
# 'probe()' borrowed from LILO QuickInst.
probe()
{
[ ! -z "`dd if=$1 bs=1 count=1 2>/dev/null | tr '\0' x`" ]
return
}
# liloconfig-color?
if [ "`basename $0`" = "liloconfig-color" ]; then
COLOR=on
fi
# Figure out if we're installing from the hard drive
if [ -r $TMP/SeTT_PX ]; then
T_PX="`cat $TMP/SeTT_PX`"
else
if [ "$T_PX" = "" -a ! "$1" = "" ]; then
T_PX=$1
else
T_PX=/
fi
fi
HDR="no" # this means the header section of /etc/lilo.conf has not yet
# been configured
LNX="no" # this means no Linux partition has been defined as bootable
# through LILO. Both of these must change to "yes" before LILO will
# install from this script.
# Determine the root partition (such as /dev/hda2)
ROOT_DEVICE=$2
if [ "$ROOT_DEVICE" = "" ]; then
if [ -r $TMP/SeTrootdev ]; then
ROOT_DEVICE="`cat $TMP/SeTrootdev`"
else
ROOT_DEVICE="`mount | cut -b-10 | sed -n "1 p"`"
fi
fi
if [ -r $TMP/SeTcolor -o "$COLOR" = "on" ]; then # use color menus, otherwise tty
# If we're installing from the umsdos.gz rootdisk, suggest skipping LILO:
if [ ! "$T_PX" = "/" ]; then
if mount | fgrep " on /mnt " | fgrep umsdos 1> /dev/null 2> /dev/null ; then
dialog --title "SKIP LILO CONFIGURATION? (RECOMMENDED)" --yesno "Since \
you are installing to a FAT partition, it's suggested that you do not \
configure LILO at this time. (Instead, use your bootdisk. For booting \
off the hard drive from MS-DOS, you can use Loadlin. You'll find \
Loadlin on your hard drive in \LINUX\ROOT) Skip LILO configuration \
(highly recommended)?" 10 70
if [ $? = 0 ]; then
exit
fi
fi
fi
# OK, now let's see if we should automate things:
dialog --title "INSTALL LILO" --menu "LILO (Linux Loader) is a generic \
boot loader. There's a simple installation which tries to automatically \
set up LILO to boot Linux (also DOS, Windows, and OS/2 if found). For \
more advanced users, the expert option offers more control over the \
installation process. Since LILO does not work in all cases (and can \
damage partitions if incorrectly installed), there's the third (safe) \
option, which is to skip installing LILO for now. You can always install \
it later with the 'liloconfig' command. Which option would you like?" \
18 67 3 \
"simple" "Try to install LILO automatically" \
"expert" "Use expert lilo.conf setup menu" \
"skip" "Do not install LILO" 2> $TMP/reply
if [ $? = 1 -o $? = 255 ]; then
exit
fi
REPLY="`cat $TMP/reply`"
rm -f $TMP/reply
if [ "$REPLY" = "skip" ]; then
exit
elif [ "$REPLY" = "simple" ]; then
# Do simple LILO setup
simplelilo
exit
fi
# drop through to last option: (use the expert menus)
while [ 0 ]; do
dialog --title "EXPERT LILO INSTALLATION" --menu \
"This menu directs the creation of the LILO config file, lilo.conf. \
To install, you make a new LILO configuration file by creating a new header \
and then adding one or more bootable partitions to the file. Once you've done \
this, you can select the install option. Alternately, if you already have an \
/etc/lilo.conf, you may reinstall using that. If you make a mistake, you can \
always start over by choosing 'Begin'. \
Which option would you like?" 22 73 9 \
"Begin" "Start LILO configuration with a new LILO header" \
"Linux" "Add a Linux partition to the LILO config file" \
"OS/2" "Add an OS/2 partition to the LILO config file" \
"DOS" "Add a DOS partition to the LILO config file" \
"Install" "Install LILO" \
"Recycle" "Reinstall LILO using the existing lilo.conf" \
"Skip" "Skip LILO installation and exit this menu" \
"View" "View your current /etc/lilo.conf" \
"Help" "Read the Linux Loader HELP file" 2> $TMP/reply
if [ $? = 1 -o $? = 255 ]; then
REPLY="Skip"
else
REPLY="`cat $TMP/reply`"
fi
rm -r $TMP/reply
if [ "$REPLY" = "Begin" ]; then
dialog --title "OPTIONAL append= LINE" --inputbox "Some systems might \
require extra parameters to be passed to the kernel in order to boot. An \
example would be the hd=cyl,hds,secs needed with some SCSI systems and some \
machines with IBM motherboards. If you \
needed to pass parameters to the kernel when you booted the Slackware \
bootkernel disk, you'll probably want to enter the same ones here. Most \
systems won't require any extra parameters. If you don't need any, just \
hit ENTER to continue." 14 72 2> $TMP/reply
if [ $? = 1 -o $? = 255 ]; then
HDR="no"
continue;
else
APPEND="`cat $TMP/reply`"
fi
dialog --title "SELECT LILO TARGET LOCATION" --menu "LILO can be installed \
to a variety of places: the master boot record of your first hard drive, the \
superblock of your root Linux partition (which could then be made the \
bootable partition with fdisk), or a formatted floppy disk. If you're using \
a boot system such as OS/2's Boot Manager, you should use the "Root" \
selection. Please pick a target location:" 16 65 3 \
"MBR" "Use the Master Boot Record" \
"Root" "Use superblock of the root Linux partition" \
"Floppy" "Use a formatted floppy disk in the boot drive" 2> $TMP/reply
if [ $? = 1 -o $? = 255 ]; then
HDR="no"
continue;
else
LNX="no"
TG="`cat $TMP/reply`"
fi
rm -r $TMP/reply
if [ "$TG" = "MBR" ]; then
if [ -L $T_PX/dev/hda ]; then
LILO_TARGET="/dev/sda"
elif probe /dev/hda; then
CDROM_LINK=`/bin/ls -l $T_PX/dev/cdrom`
CDROM_LINK=`echo $CDROM_LINK | cut -f 11 -d ' '`
if [ "$CDROM_LINK" = "/dev/hda" -o "$CDROM_LINK" = "hda" ]; then
LILO_TARGET="/dev/sda" # It must be sda, if there's a CDROM on hda.
else
LILO_TARGET="/dev/hda"
fi
elif probe /dev/sda; then
LILO_TARGET="/dev/sda"
else
dialog --msgbox "LILO can't find your first hard drive! Sorry, \
but LILO is getting /dev/null'ed..." 10 50
LILO_TARGET="/dev/null"
fi
elif [ "$TG" = "Root" ]; then
LILO_TARGET=`echo $ROOT_DEVICE` # Here, we use the partition superblock for OS/2 Boot Manager
elif [ "$TG" = "Floppy" ]; then
LILO_TARGET="/dev/fd0"
else
HDR="no"
continue;
fi
dialog --title "CHOOSE LILO DELAY" --menu "How long would you like \
LILO to wait for you to hit left-shift to get a prompt after rebooting? If you \
let LILO time out, it will boot the first OS in the configuration file by \
default." 13 72 4 \
"None" "Don't wait at all - boot straight into the first OS" \
"5" "5 seconds" \
"30" "30 seconds" \
"Forever" "Present a prompt and wait until a choice is made" 2> $TMP/reply
if [ $? = 1 -o $? = 255 ]; then
HDR="no"
continue;
else
DELAY="`cat $TMP/reply`"
fi
rm -r $TMP/reply
if [ "$DELAY" = "None" ]; then
DELAY="# delay = 5"
elif [ "$DELAY" = "5" ]; then
DELAY="delay = 50"
elif [ "$DELAY" = "30" ]; then
DELAY="delay = 300"
elif [ "$DELAY" = "Forever" ]; then
DELAY="prompt"
else
HDR="no"
continue;
fi
if [ "$APPEND" = "" ]; then
cat << EOF > $TMP/lilo.conf
# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
boot = $LILO_TARGET
#compact # faster, but won't work on all systems.
$DELAY
vga = normal # force sane state
# ramdisk = 0 # paranoia setting
# End LILO global section
EOF
HDR="yes"
else
cat << EOF > $TMP/lilo.conf
# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
append="$APPEND"
boot = $LILO_TARGET
#compact # faster, but won't work on all systems.
$DELAY
vga = normal # force sane state
# ramdisk = 0 # paranoia setting
# End LILO global section
EOF
HDR="yes"
fi
elif [ "$REPLY" = "Linux" ]; then
if [ "$HDR" = "yes" ]; then
echo "These are your Linux partitions:" > $TMP/tmpmsg
echo >> $TMP/tmpmsg
echo " Device Boot Begin Start End Blocks Id System" >> $TMP/tmpmsg
$PROBE -l | fgrep Linux | fgrep native >> $TMP/tmpmsg
echo >> $TMP/tmpmsg
echo "Which one would you like LILO to boot?" >> $TMP/tmpmsg
dialog --title "SELECT LINUX PARTITION" --inputbox \
"`cat $TMP/tmpmsg`" 20 74 2> $TMP/reply
if [ $? = 1 -o $? = 255 ]; then
rm $TMP/tmpmsg
continue
fi
rm $TMP/tmpmsg
LINUX_PART="`cat $TMP/reply`"
checkp_dialog $LINUX_PART
if [ ! $? = 0 ]; then
continue;
fi
dialog --title "SELECT PARTITION NAME" --inputbox \
"Now you must select a short, unique name for this partition. \
You'll use this name if you specify a partition to boot at the \
LILO prompt. 'Linux' might not be a bad choice. THIS MUST BE A \
SINGLE WORD." 11 60 2> $TMP/reply
if [ $? = 1 -o $? = 255 ]; then
continue
fi
LABEL="`cat $TMP/reply`"
cat << EOF >> $TMP/lilo.conf
# Linux bootable partition config begins
image = /vmlinuz
root = $LINUX_PART
label = $LABEL
read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends
EOF
else
dialog --title "CAN'T ADD LINUX PARTITION" --msgbox "You can't add \
partitions unless you start over with a new LILO header." 6 60
continue
fi
LNX="yes"
elif [ "$REPLY" = "OS/2" ]; then
if [ "$HDR" = "yes" ]; then
echo "These are possibly OS/2 partitions. They will be treated" > $TMP/tmpmsg
echo "as such if you install them using this menu." >> $TMP/tmpmsg
echo >> $TMP/tmpmsg
echo " Device Boot Begin Start End Blocks Id System" >> $TMP/tmpmsg
$PROBE -l | fgrep DOS >> $TMP/tmpmsg
$PROBE -l | fgrep HPFS >> $TMP/tmpmsg
echo >> $TMP/tmpmsg
echo "Which one would you like LILO to boot?" >> $TMP/tmpmsg
dialog --title "SELECT OS/2 PARTITION" --inputbox \
"`cat $TMP/tmpmsg`" 20 74 2> $TMP/reply
if [ $? = 1 -o $? = 255 ]; then
rm $TMP/tmpmsg
continue
fi
rm $TMP/tmpmsg
OS_2_PART="`cat $TMP/reply`"
checkp_dialog $OS_2_PART
if [ ! $? = 0 ]; then
continue;
fi
dialog --title "SELECT PARTITION NAME" --inputbox \
"Now you must select a short, unique name for this partition. \
You'll use this name if you specify a partition to boot at the \
LILO prompt. 'OS/2' might not be a bad choice. THIS MUST BE A \
SINGLE WORD." 11 60 2> $TMP/reply
if [ $? = 1 -o $? = 255 ]; then
continue
fi
LABEL="`cat $TMP/reply`"
TABLE="`echo $OS_2_PART | cut -b1-8`"
if [ "`echo $TABLE | cut -b6-8`" = "hda" ]; then
cat << EOF >> $TMP/lilo.conf
# OS/2 bootable partition config begins
other = $OS_2_PART
label = $LABEL
table = $TABLE
# OS/2 bootable partition config ends
EOF
else
cat << EOF >> $TMP/lilo.conf
# OS/2 bootable partition config begins
other = $OS_2_PART
label = $LABEL
table = $TABLE
loader = /boot/os2_d.b
map-drive = 0x80
to = 0x81
map-drive = 0x81
to = 0x80
# OS/2 bootable partition config ends
EOF
fi
else
dialog --title "CAN'T ADD OS/2 PARTITION" --msgbox "You can't add \
partitions unless you start over with a new LILO header." 6 60
continue
fi
LNX="yes"
elif [ "$REPLY" = "DOS" ]; then
if [ "$HDR" = "yes" ]; then
echo "These are possibly DOS partitions. They will be treated" > $TMP/tmpmsg
echo "as such if you install them using this menu." >> $TMP/tmpmsg
echo >> $TMP/tmpmsg
echo " Device Boot Begin Start End Blocks Id System" >> $TMP/tmpmsg
$PROBE -l | fgrep DOS >> $TMP/tmpmsg
echo >> $TMP/tmpmsg
echo "Which one would you like LILO to boot?" >> $TMP/tmpmsg
dialog --title "SELECT DOS PARTITION" --inputbox \
"`cat $TMP/tmpmsg`" 20 74 2> $TMP/reply
if [ $? = 1 -o $? = 255 ]; then
rm $TMP/tmpmsg
continue
fi
rm $TMP/tmpmsg
DOSPART="`cat $TMP/reply`"
checkp_dialog $DOSPART
if [ ! $? = 0 ]; then
continue;
fi
dialog --title "SELECT PARTITION NAME" --inputbox \
"Now you must select a short, unique name for this partition. \
You'll use this name if you specify a partition to boot at the \
LILO prompt. 'DOS' might not be a bad choice. THIS MUST BE A \
SINGLE WORD." 11 60 2> $TMP/reply
if [ $? = 1 -o $? = 255 ]; then
continue
fi
LABEL="`cat $TMP/reply`"
unset USE_LOADER
TABLE="`echo $DOSPART | cut -b1-8`"
if [ "`echo $TABLE | cut -b6-8`" = "hda" ]; then
USE_LOADER="no"
fi
if [ "`echo $TABLE | cut -b6-8`" = "sda" ]; then
if probe /dev/hda; then
USE_LOADER="yes"
else
USE_LOADER="no"
fi
fi
if [ "$USE_LOADER" = "no" ]; then
cat << EOF >> $TMP/lilo.conf
# DOS bootable partition config begins
other = $DOSPART
label = $LABEL
table = $TABLE
# DOS bootable partition config ends
EOF
else
cat << EOF >> $TMP/lilo.conf
# DOS bootable partition config begins
other = $DOSPART
label = $LABEL
map-drive = 0x80
to = 0x81
map-drive = 0x81
to = 0x80
table = $TABLE
# DOS bootable partition config ends
EOF
fi
else
dialog --title "CAN'T ADD DOS PARTITION" --msgbox "You can't add \
partitions unless you start over with a new LILO header." 6 60
continue
fi
LNX="yes"
elif [ "$REPLY" = "Install" -o "$REPLY" = "Recycle" ]; then
if [ "$REPLY" = "Recycle" -a -r $T_PX/etc/lilo.conf ]; then
LNX="yes"
fi
if [ "$LNX" = "no" ]; then
dialog --title "CAN'T INSTALL LILO" --msgbox "LILO could not be \
installed. If you have not created a LILO configuration file by defining \
a new header and adding at least one bootable partition to it, you must do \
so before installing LILO. If you were attempting to use an existing LILO \
configuration file, it could not be found. Try making a new one." 9 70
continue
else
if [ "$REPLY" = "Install" ]; then
if [ -r $TMP/lilo.conf ]; then
if [ -r $T_PX/etc/lilo.conf ]; then
mv $T_PX/etc/lilo.conf $T_PX/etc/lilo.conf.bak
fi
cp $TMP/lilo.conf $T_PX/etc/lilo.conf
chmod 644 $T_PX/etc/lilo.conf
fi
fi
dialog --infobox "\nInstalling the Linux Loader..." 5 40
if [ "$T_PX" = "/" ]; then
lilo 1> /dev/null 2> /dev/null
else
lilo -r $T_PX -m /boot/map -C /etc/lilo.conf 1> /dev/null 2> /dev/null
fi
fi
rm -f $TMP/tmpmsg $TMP/reply
break
elif [ "$REPLY" = "Skip" ]; then
rm -f $TMP/tmpmsg $TMP/reply
break
elif [ "$REPLY" = "View" ]; then
if [ -r $TMP/lilo.conf ]; then
dialog --title "YOUR NEW /etc/lilo.conf" --textbox "$TMP/lilo.conf" 22 70
else
if [ -r /mnt/etc/lilo.conf ]; then
dialog --title "YOUR OLD /etc/lilo.conf" --textbox "/mnt/etc/lilo.conf" 22 70
elif [ "$T_PX" = "/" -a -r /etc/lilo.conf ]; then
dialog --title "YOUR OLD /etc/lilo.conf" --textbox "/etc/lilo.conf" 22 70
else
dialog --title "NO CONFIG FILE FOUND" --msgbox "Sorry, but you don't \
have a LILO configuration file that can be viewed." 6 60
fi
fi
elif [ "$REPLY" = "Help" ]; then
dialog --title "LILO INSTALLATION HELP" --textbox "$T_PX/usr/log/setup/text.lilohelp" 22 68
fi
done
else # don't use color!
while [ 0 ]; do
cat << EOF
LILO INSTALLATION
LILO (the Linux Loader) is the program that allows booting Linux directly from
the hard drive. To install, you make a new LILO configuration file by creating
a new header and then adding at least one bootable partition to the file. Once
you've done this, you can select the install option. Alternately, if you
already have an /etc/lilo.conf, you may reinstall using that. If you make a
mistake, just select (1) to start over.
1 -- Start LILO configuration with a new LILO header
2 -- Add a Linux partition to the LILO config file
3 -- Add an OS/2 partition to the LILO config file
4 -- Add a DOS partition to the LILO config file
5 -- Install LILO
6 -- Reinstall LILO using the existing lilo.conf
7 -- Skip LILO installation and exit this menu
8 -- View your current /etc/lilo.conf
9 -- Read the Linux Loader HELP file
EOF
echo -n "Which option would you like (1 - 9)? "
read REPLY;
echo
if [ "$REPLY" = "1" ]; then
cat << EOF
OPTIONAL append="" LINE
Some systems might require extra parameters to be passed to the kernel in order
to boot. An example would be the hd=cyl,hds,secs needed with some SCSI systems
and some machines with IBM motherboards. If you needed to pass parameters to the
kernel when you booted the Slackware bootkernel disk, you'll probably want to
enter the same ones here.
Most systems won't require any extra parameters. If you don't need any, just
hit ENTER to continue.
EOF
echo -n "Enter extra parameters==> "
read APPEND;
echo
cat << EOF
SELECT LILO TARGET LOCATION
LILO can be installed to a variety of places:
1. The Master Boot Record of your first hard drive
2. The superblock of your root Linux partition (which could then
be made the bootable partition with fdisk)
3. A formatted floppy disk
If you're using a boot system such as OS/2's Boot Manager, you should install
LILO on the superblock of your root Linux partition.
EOF
echo -n "Please pick a target location (1 - 3): "
read TG;
echo
if [ "$TG" = "1" ]; then
if [ -L $T_PX/dev/hda ]; then
LILO_TARGET="/dev/sda"
elif probe /dev/hda; then
LILO_TARGET="/dev/hda"
elif probe /dev/sda; then
LILO_TARGET="/dev/sda"
else
cat << EOF
***** ERROR probing for first hard drive.
LILO can't find your first hard drive! Sorry, but LILO is
getting /dev/null'ed...
EOF
LILO_TARGET="/dev/null"
fi
elif [ "$TG" = "2" ]; then
LILO_TARGET=`echo $ROOT_DEVICE` # Here, we use the partition superblock for OS/2 Boot Manager
elif [ "$TG" = "3" ]; then
LILO_TARGET="/dev/fd0"
else
HDR="no"
continue;
fi
cat << EOF
CHOOSE LILO DELAY
How long would you like LILO to wait for you to hit left-shift to
get a prompt after rebooting? If you let LILO time out, it will boot
the first OS in the configuration file by default.
1 -- None, don't wait at all - boot straight into the first OS
2 -- 5 seconds
3 -- 30 seconds
4 -- Present a prompt and wait until a choice is made without timing out
EOF
echo -n "Which choice would you like (1 - 4)? "
read DELAY;
echo
if [ "$DELAY" = "1" ]; then
DELAY="# delay = 5"
elif [ "$DELAY" = "2" ]; then
DELAY="delay = 50"
elif [ "$DELAY" = "3" ]; then
DELAY="delay = 300"
elif [ "$DELAY" = "4" ]; then
DELAY="prompt"
else
HDR="no"
continue;
fi
if [ "$APPEND" = "" ]; then
cat << EOF > $TMP/lilo.conf
# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
boot = $LILO_TARGET
#compact # faster, but won't work on all systems.
$DELAY
vga = normal # force sane state
# ramdisk = 0 # paranoia setting
# End LILO global section
EOF
HDR="yes"
else
cat << EOF > $TMP/lilo.conf
# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
append="$APPEND"
boot = $LILO_TARGET
#compact # faster, but won't work on all systems.
$DELAY
vga = normal # force sane state
# ramdisk = 0 # paranoia setting
# End LILO global section
EOF
HDR="yes"
fi
elif [ "$REPLY" = "2" ]; then
if [ "$HDR" = "yes" ]; then
while [ 0 ]; do
cat << EOF
SELECT LINUX PARTITION
These are your Linux partitions:
Device Boot Begin Start End Blocks Id System
`fdisk -l | fgrep Linux | fgrep native`
EOF
echo -n "Which one would you like LILO to boot? "
read LINUX_PART;
checkp_text $LINUX_PART
if [ $? = 0 ]; then
break;
fi
done
echo
cat << EOF
SELECT PARTITION NAME
Now you must select a short, unique name for this partition.
You'll use this name if you specify a partition to boot at the
LILO prompt. 'Linux' might not be a bad choice.
THIS MUST BE A SINGLE WORD.
EOF
echo -n "Enter name: "
read LABEL;
cat << EOF >> $TMP/lilo.conf
# Linux bootable partition config begins
image = /vmlinuz
root = $LINUX_PART
label = $LABEL
read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends
EOF
else
cat << EOF
CAN'T ADD LINUX PARTITION
You can't add partitions unless you start over
with a new LILO header.
EOF
echo -n "Press ENTER to continue."
read JUNK;
echo
continue
fi
LNX="yes"
elif [ "$REPLY" = "3" ]; then
if [ "$HDR" = "yes" ]; then
while [ 0 ]; do
cat << EOF
SELECT OS/2 PARTITION
These are possibly OS/2 partitions. They will be treated
as such if you install them using this menu.
Device Boot Begin Start End Blocks Id System
`fdisk -l | fgrep DOS`
`fdisk -l | fgrep HPFS`
EOF
echo -n "Which one would you like LILO to boot? "
read OS_2_PART;
checkp_text $OS_2_PART
if [ $? = 0 ]; then
break;
fi
done
echo
cat << EOF
SELECT PARTITION NAME
Now you must select a short, unique name for this partition.
You'll use this name if you specify a partition to boot at the
LILO prompt. 'OS/2' might not be a bad choice.
THIS MUST BE A SINGLE WORD.
EOF
echo -n "Enter name: "
read LABEL;
echo
TABLE="`echo $OS_2_PART | cut -b1-8`"
if [ "`echo $TABLE | cut -b6-8`" = "hda" ]; then
cat << EOF >> $TMP/lilo.conf
# OS/2 bootable partition config begins
other = $OS_2_PART
label = $LABEL
table = $TABLE
# OS/2 bootable partition config ends
EOF
else
cat << EOF >> $TMP/lilo.conf
# OS/2 bootable partition config begins
other = $OS_2_PART
label = $LABEL
table = $TABLE
loader = /boot/os2_d.b
map-drive = 0x80
to = 0x81
map-drive = 0x81
to = 0x80
# OS/2 bootable partition config ends
EOF
fi
else
cat << EOF
CAN'T ADD OS/2 PARTITION
You can't add partitions unless you start over
with a new LILO header.
EOF
echo -n "Press ENTER to continue."
read JUNK;
echo
continue
fi
LNX="yes"
elif [ "$REPLY" = "4" ]; then
if [ "$HDR" = "yes" ]; then
while [ 0 ]; do
cat << EOF
SELECT DOS PARTITION
These are possibly DOS partitions. They will be treated
as such if you install them using this menu.
Device Boot Begin Start End Blocks Id System"
`fdisk -l | fgrep DOS`
EOF
echo -n "Which one would you like LILO to boot? "
read DOSPART;
checkp_text $DOSPART
if [ $? = 0 ]; then
break;
fi
done
cat << EOF
SELECT PARTITION NAME
Now you must select a short, unique name for this partition.
You'll use this name if you specify a partition to boot at the
LILO prompt. 'DOS' might not be a bad choice.
THIS MUST BE A SINGLE WORD.
EOF
echo -n "Enter name: "
read LABEL;
echo
TABLE="`echo $DOSPART | cut -b1-8`"
unset USE_LOADER
if [ "`echo $TABLE | cut -b6-8`" = "hda" ]; then
USE_LOADER="no"
fi
if [ "`echo $TABLE | cut -b6-8`" = "sda" ]; then
if probe /dev/hda; then
USE_LOADER="yes"
else
USE_LOADER="no"
fi
fi
if [ "$USE_LOADER" = "no" ]; then
cat << EOF >> $TMP/lilo.conf
# DOS bootable partition config begins
other = $DOSPART
label = $LABEL
table = $TABLE
# DOS bootable partition config ends
EOF
else
cat << EOF >> $TMP/lilo.conf
# DOS bootable partition config begins
other = $DOSPART
label = $LABEL
map-drive = 0x80
to = 0x81
map-drive = 0x81
to = 0x80
table = $TABLE
# DOS bootable partition config ends
EOF
fi
else
cat << EOF
CAN'T ADD DOS PARTITION
You can't add partitions unless you start over
with a new LILO header.
EOF
echo -n "Press ENTER to continue."
read JUNK;
echo
continue
fi
LNX="yes"
elif [ "$REPLY" = "5" -o "$REPLY" = "6" ]; then
if [ "$REPLY" = "6" -a -r $T_PX/etc/lilo.conf ]; then
LNX="yes"
fi
if [ "$LNX" = "no" ]; then
cat << EOF
CAN'T INSTALL LILO
LILO could not be installed. If you have not created a LILO
configuration file by defining a new header and adding at least
one bootable partition to it, you must do so before installing
LILO. If you were attempting to use an existing LILO configuration
file, it could not be found. Try making a new one.
EOF
echo -n "Press ENTER to continue."
read JUNK;
echo
continue
else
if [ "$REPLY" = "5" ]; then
if [ -r $TMP/lilo.conf ]; then
if [ -r $T_PX/etc/lilo.conf ]; then
mv $T_PX/etc/lilo.conf $T_PX/etc/lilo.conf.bak
fi
cp $TMP/lilo.conf $T_PX/etc/lilo.conf
chmod 644 $T_PX/etc/lilo.conf
fi
fi
echo
echo "Installing the Linux Loader..."
if [ "$T_PX" = "/" ]; then
lilo
else
lilo -r $T_PX -m /boot/map -C /etc/lilo.conf
fi
fi
rm -f $TMP/tmpmsg $TMP/reply
break
elif [ "$REPLY" = "7" ]; then
rm -f $TMP/tmpmsg $TMP/reply
break
elif [ "$REPLY" = "8" ]; then
if [ -r $TMP/lilo.conf ]; then
if [ -r /bin/more ]; then
cat $TMP/lilo.conf | more
else
cat $TMP/lilo.conf
fi
echo -n "Press ENTER to continue..."
read JUNK;
echo
else
if [ -r /mnt/etc/lilo.conf ]; then
if [ -r /bin/more ]; then
cat /mnt/etc/lilo.conf | more
else
cat /mnt/etc/lilo.conf
fi
echo -n "Press ENTER to continue..."
read JUNK;
echo
elif [ "$T_PX" = "/" -a -r /etc/lilo.conf ]; then
if [ -r /bin/more ]; then
cat /etc/lilo.conf | more
else
cat /etc/lilo.conf
fi
echo -n "Press ENTER to continue..."
read JUNK;
echo
else
cat << EOF
NO CONFIG FILE FOUND
Sorry, but you don't have a LILO configuration file that can be viewed.
EOF
echo -n "Press ENTER to continue..."
read JUNK;
echo
fi
fi
elif [ "$REPLY" = "9" ]; then
if [ -r /bin/more ]; then
cat $T_PX/usr/log/setup/text.lilohelp | more
else
cat $T_PX/usr/log/setup/text.lilohelp
echo -n "Sorry... there's no pager on this disk. Press ENTER to continue."
read JUNK;
echo
fi
fi
done
echo
fi # are we using color?